// 统一的Mock数据配置
// 确保所有页面的数据保持一致

// 真实的中文姓名库
export const REAL_NAMES = [
  "李明轩", "王雨桐", "张浩然", "刘雅琪", "陈志强", "杨梦瑶", "赵天宇", "孙思涵",
  "周博文", "吴欣怡", "徐子轩", "朱雨薇", "胡俊杰", "郭雅琴", "何志明", "高梦洁",
  "林浩然", "罗雅琪", "梁志强", "宋梦瑶", "郑天宇", "谢思涵", "韩博文", "唐欣怡",
  "冯子轩", "于雨薇", "董俊杰", "萧雅琴", "程志明", "曹梦洁", "袁浩然", "潘雅琪",
  "姜志强", "魏梦瑶", "蒋天宇", "韦思涵", "傅博文", "沈欣怡", "卢子轩", "姚雨薇",
  "汪俊杰", "田雅琴", "方志明", "石梦洁", "龚浩然", "程雅琪", "邹志强", "孟梦瑶",
  "熊天宇", "秦思涵", "白博文", "江欣怡", "薛子轩", "尹雨薇", "闫俊杰", "段雅琴",
  "雷志明", "侯梦洁", "龙浩然", "史雅琪", "陶志强", "黎梦瑶", "贺天宇", "顾思涵",
  "毛博文", "郝欣怡", "龚子轩", "邵雨薇", "万俊杰", "钱雅琴", "严志明", "覃梦洁",
  "武浩然", "戴雅琪", "莫志强", "孔梦瑶", "向天宇", "汤思涵", "常博文", "温欣怡",
  "康子轩", "施雨薇", "文俊杰", "牛雅琴", "樊志明", "葛梦洁", "邢浩然", "安雅琪",
  "齐志强", "易梦瑶", "乔天宇", "庞思涵", "章博文", "梅欣怡", "盛子轩", "童雨薇",
  "凌俊杰", "霍雅琴", "虞志明", "万梦洁", "支浩然", "柯雅琪", "昝志强", "管梦瑶",
  "卢天宇", "莫思涵", "经博文", "房欣怡", "缪子轩", "干雨薇", "解俊杰", "应雅琴",
  "宗志明", "丁梦洁", "宣浩然", "贲雅琪", "邓志强", "郁梦瑶", "单天宇", "杭思涵",
  "洪博文", "包欣怡", "诸子轩", "左雨薇", "石俊杰", "崔雅琴", "吉志明", "钮梦洁",
  "龚浩然", "程雅琪", "嵇志强", "邢梦瑶", "滑天宇", "裴思涵", "陆博文", "荣欣怡",
  "翁子轩", "荀雨薇", "羊俊杰", "於雅琴", "惠志明", "甄梦洁", "曲浩然", "家雅琪",
  "封志强", "芮梦瑶", "羿天宇", "储思涵", "靳博文", "汲欣怡", "邴子轩", "糜雨薇",
  "松俊杰", "井雅琴", "段志明", "富梦洁", "巫浩然", "乌雅琪", "焦志强", "巴梦瑶",
  "弓天宇", "牧思涵", "隗博文", "山欣怡", "谷子轩", "车雨薇", "侯俊杰", "宓雅琴",
  "蓬志明", "全梦洁", "郗浩然", "班雅琪", "仰志强", "秋梦瑶", "仲天宇", "伊思涵",
  "宫博文", "宁欣怡", "仇子轩", "栾雨薇", "暴俊杰", "甘雅琴", "钭志明", "厉梦洁",
  "戎浩然", "祖雅琪", "武志强", "符梦瑶", "刘天宇", "景思涵", "詹博文", "束欣怡",
  "龙子轩", "叶雨薇", "幸俊杰", "司雅琴", "韶志明", "郜梦洁", "黎浩然", "蓟雅琪",
  "薄志强", "印梦瑶", "宿天宇", "白思涵", "怀博文", "蒲欣怡", "邰子轩", "从雨薇",
  "鄂俊杰", "索雅琴", "咸志明", "籍梦洁", "赖浩然", "卓雅琪", "蔺志强", "屠梦瑶",
  "蒙天宇", "池思涵", "乔博文", "阴欣怡", "郁子轩", "胥雨薇", "能俊杰", "苍雅琴",
  "双志明", "闻梦洁", "莘浩然", "党雅琪", "翟志强", "谭梦瑶", "贡天宇", "劳思涵",
  "逄博文", "姬欣怡", "申子轩", "扶雨薇", "堵俊杰", "冉雅琴", "宰志明", "郦梦洁",
  "雍浩然", "舄雅琪", "璩志强", "桑梦瑶", "桂天宇", "濮思涵", "牛博文", "寿欣怡",
  "通子轩", "边雨薇", "扈俊杰", "燕雅琴", "冀志明", "郏梦洁", "浦浩然", "尚雅琪",
  "农志强", "温梦瑶", "别天宇", "庄思涵", "晏博文", "柴欣怡", "瞿子轩", "阎雨薇",
  "充俊杰", "慕雅琴", "连志明", "茹梦洁", "习浩然", "宦雅琪", "艾志强", "鱼梦瑶",
  "容天宇", "向思涵", "古博文", "易欣怡", "慎子轩", "戈雨薇", "廖俊杰", "庾雅琴",
  "终志明", "暨梦洁", "居浩然", "衡雅琪", "步志强", "都梦瑶", "耿天宇", "满思涵",
  "弘博文", "匡欣怡", "国子轩", "文雨薇", "寇俊杰", "广雅琴", "禄志明", "阙梦洁",
  "东浩然", "欧雅琪", "殳志强", "沃梦瑶", "利天宇", "蔚思涵", "越博文", "夔欣怡",
  "隆子轩", "师雨薇", "巩俊杰", "厍雅琴", "聂志明", "晁梦洁", "勾浩然", "敖雅琪",
  "融志强", "冷梦瑶", "訾天宇", "辛思涵", "阚博文", "那欣怡", "简子轩", "饶雨薇",
  "空俊杰", "曾雅琴", "毋志明", "沙梦洁", "乜浩然", "养雅琪", "鞠志强", "须梦瑶",
  "丰天宇", "巢思涵", "关博文", "蒯欣怡", "相子轩", "查雨薇", "后俊杰", "荆雅琴",
  "红志明", "游梦洁", "竺浩然", "权雅琪", "逯志强", "盖梦瑶", "益天宇", "桓思涵",
  "公博文", "万俟欣怡", "司马子轩", "上官雨薇", "欧阳俊杰", "夏侯雅琴", "诸葛志明", 
  "闻人梦洁", "东方浩然", "赫连雅琪", "皇甫志强", "尉迟梦瑶", "公羊天宇", "澹台思涵",
  "公冶博文", "宗政欣怡", "濮阳子轩", "淳于雨薇", "单于俊杰", "太叔雅琴", "申屠志明",
  "公孙梦洁", "仲孙浩然", "轩辕雅琪", "令狐志强", "钟离梦瑶", "宇文天宇", "长孙思涵",
  "慕容博文", "司徒欣怡", "司空子轩", "亓官雨薇", "司寇俊杰", "仉督雅琴", "子车志明",
  "颛孙梦洁", "端木浩然", "巫马雅琪", "公西志强", "漆雕梦瑶", "乐正天宇", "壤驷思涵",
  "公良博文", "拓跋欣怡", "夹谷子轩", "晋楚雨薇", "阎法俊杰", "汝鄢雅琴", "涂钦志明",
  "段干梦洁", "百里浩然", "东郭雅琪", "南门志强", "呼延梦瑶", "归海天宇", "羊舌思涵",
  "微生博文", "岳帅欣怡", "缑亢子轩", "况后有雨薇", "琴俊杰", "梁丘雅琴", "左丘志明",
  "东门梦洁", "西门浩然", "商雅琪", "佘佴志强", "伯赏梦瑶", "南宫天宇", "墨哈思涵",
  "谯笪博文", "年爱欣怡", "阳佟子轩", "第五雨薇", "言福俊杰", "福雅琴", "福志明"
];

// 教师数据
export const TEACHERS = [
  {
    id: "t1",
    name: "张教授",
    email: "zhang@university.edu",
    department: "计算机学院",
    title: "教授",
    phone: "13800000001",
    avatar: "https://api.dicebear.com/7.x/personas/svg?seed=zhang"
  },
  {
    id: "t2", 
    name: "李副教授",
    email: "li@university.edu",
    department: "计算机学院",
    title: "副教授",
    phone: "13800000002",
    avatar: "https://api.dicebear.com/7.x/personas/svg?seed=li"
  },
  {
    id: "t3",
    name: "王讲师",
    email: "wang@university.edu", 
    department: "计算机学院",
    title: "讲师",
    phone: "13800000003",
    avatar: "https://api.dicebear.com/7.x/personas/svg?seed=wang"
  }
];

// 班级数据
export const CLASSES = [
  {
    id: "cls1",
    name: "计科2301班",
    code: "CS2301",
    grade: "2023级",
    major: "计算机科学与技术",
    studentCount: 45,
    maxStudents: 50
  },
  {
    id: "cls2", 
    name: "软工2301班",
    code: "SE2301",
    grade: "2023级",
    major: "软件工程",
    studentCount: 42,
    maxStudents: 45
  },
  {
    id: "cls3",
    name: "计科2401班",
    code: "CS2401", 
    grade: "2024级",
    major: "计算机科学与技术",
    studentCount: 11,
    maxStudents: 50
  },
  {
    id: "cls4",
    name: "数据2301班",
    code: "DS2301",
    grade: "2023级",
    major: "数据科学与大数据技术",
    studentCount: 27,
    maxStudents: 35
  },
  {
    id: "cls5",
    name: "AI2301班",
    code: "AI2301",
    grade: "2023级",
    major: "人工智能",
    studentCount: 35,
    maxStudents: 40
  },
  {
    id: "cls6",
    name: "软工2401班",
    code: "SE2401",
    grade: "2024级",
    major: "软件工程",
    studentCount: 44,
    maxStudents: 50
  }
];

// 课程数据
export const COURSES = [
  {
    id: "c1",
    name: "数据结构与算法",
    code: "CS101",
    semester: "2024春季",
    credits: 4,
    description: "介绍基本数据结构和算法设计",
    status: "active" as const,
    maxStudents: 120,
    currentStudents: 98, // 45 + 42 + 11 = 98
    teacher: TEACHERS[0],
    schedule: "周一3-4节，周三1-2节",
    location: "教学楼A101",
    createTime: "2024-01-15",
    classIds: ["cls1", "cls2", "cls3"] // 对应班级ID
  },
  {
    id: "c2",
    name: "Java程序设计",
    code: "CS102",
    semester: "2024春季",
    credits: 3,
    description: "Java语言基础与面向对象编程",
    status: "active" as const,
    maxStudents: 100,
    currentStudents: 87, // 45 + 42 = 87
    teacher: TEACHERS[1],
    schedule: "周二1-2节，周四3-4节",
    location: "教学楼A102",
    createTime: "2024-01-16",
    classIds: ["cls1", "cls2"] // 对应班级ID
  },
  {
    id: "c3",
    name: "数据库原理",
    code: "CS103",
    semester: "2024春季",
    credits: 3,
    description: "数据库系统原理与应用",
    status: "active" as const,
    maxStudents: 80,
    currentStudents: 72, // 45 + 27 = 72
    teacher: TEACHERS[2],
    schedule: "周五1-3节",
    location: "教学楼A103",
    createTime: "2024-01-17",
    classIds: ["cls1", "cls4"] // 对应班级ID
  }
];

// 生成学生数据的函数
export const generateStudents = (count: number, major: string, grade: string, startIndex: number = 0) => {
  return Array.from({ length: count }, (_, index) => ({
    id: `s${startIndex + index + 1}`,
    name: REAL_NAMES[(startIndex + index) % REAL_NAMES.length],
    studentNumber: `2024${String(startIndex + index + 1).padStart(4, '0')}`,
    grade,
    major,
    email: `${REAL_NAMES[(startIndex + index) % REAL_NAMES.length].replace(/\s+/g, '')}@student.edu`,
    phone: `138${String(Math.floor(Math.random() * 100000000)).padStart(8, '0')}`,
    avatar: `https://api.dicebear.com/7.x/personas/svg?seed=${startIndex + index + 1}`,
    status: "active" as const,
    enrollTime: "2024-02-20",
    gpa: Math.round((3.0 + Math.random() * 1.5) * 100) / 100
  }));
};

// 获取完整的课程数据（包含班级和学生）
export const getFullCourseData = () => {
  let studentIndex = 0;
  
  return COURSES.map(course => {
    const courseClasses = CLASSES.filter(cls => course.classIds.includes(cls.id));
    const classesWithStudents = courseClasses.map(cls => {
      const students = generateStudents(cls.studentCount, cls.major, cls.grade, studentIndex);
      studentIndex += cls.studentCount;
      return {
        ...cls,
        students
      };
    });
    
    return {
      ...course,
      classes: classesWithStudents
    };
  });
};

// 获取所有学生数据
export const getAllStudents = () => {
  const allStudents: any[] = [];
  let studentIndex = 0;
  
  CLASSES.forEach(cls => {
    const students = generateStudents(cls.studentCount, cls.major, cls.grade, studentIndex);
    allStudents.push(...students);
    studentIndex += cls.studentCount;
  });
  
  return allStudents;
};

// 统计数据
export const getStatistics = () => {
  const totalStudents = CLASSES.reduce((sum, cls) => sum + cls.studentCount, 0);
  const totalClasses = CLASSES.length;
  const activeCourses = COURSES.filter(c => c.status === "active").length;
  
  return {
    totalCourses: COURSES.length,
    totalStudents,
    totalClasses,
    activeCourses
  };
}; 
 
 